package cn.xtcode.domain.activity.service.trial.node;

import cn.xtcode.domain.activity.model.entity.MarketProductEntity;
import cn.xtcode.domain.activity.model.entity.TrialBalanceEntity;
import cn.xtcode.domain.activity.service.trial.AbstractGroupBuyMarketSupport;
import cn.xtcode.domain.activity.service.trial.factory.DefaultActivityStrategyFactory;
import cn.xtcode.types.design.framework.tree.StrategyHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author xt-code
 * @Description:
 * @Create 2025/5/6 12:02
 */
@Service
@Slf4j
public class RootNode extends AbstractGroupBuyMarketSupport<MarketProductEntity, DefaultActivityStrategyFactory.DynamicContext, TrialBalanceEntity> {
    @Resource
    private SwitchNode switchNode;

    @Override
    protected TrialBalanceEntity doApply(MarketProductEntity requestParameter, DefaultActivityStrategyFactory.DynamicContext dynamicContext) throws Exception {
        log.info("rootNode doApply");
        return router(requestParameter, dynamicContext);
    }

    //去下一个节点
    @Override
    public StrategyHandler<MarketProductEntity, DefaultActivityStrategyFactory.DynamicContext, TrialBalanceEntity> get(MarketProductEntity requestParameter, DefaultActivityStrategyFactory.DynamicContext dynamicContext) throws Exception {
        return switchNode;
    }
}
